import {createSlice, PayloadAction} from "@reduxjs/toolkit";
import {DEFAULT_USER} from "@/stores/LoginUser/constant";
/**
 * 登录用户全局状态
 */
export const loginUserSlice = createSlice({
    name: "loginUser",
    initialState: DEFAULT_USER,
    reducers: {
        setLoginUser: (state, action: PayloadAction<AuthAPI.UserVO>) =>
        {
            return {
                ...action.payload,
            };
        },
    },
});

// 修改状态
export const {setLoginUser} = loginUserSlice.actions;

export default loginUserSlice.reducer;
